package com.caldremch.androidcomponent;

import android.content.Context;
import android.graphics.Color;
import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;

import com.caldremch.component.widget.StatusInnerView;
import com.ldoublem.loadingviewlib.view.LVGearsTwo;

/**
 * Created by Caldremch on 2017-11-06 14:46
 *
 * 根据自己的需要定制加载状态
 */
public class MyStatusView extends StatusInnerView {

    private LVGearsTwo mLVGearsTwo;
    public MyStatusView(Context context) {
        this(context, null);
    }
    public MyStatusView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    protected int getNetErrorImage() {
        return R.mipmap.ic_launcher;
    }

    @Override
    protected String getNetErrorTips() {
        return "不好意思, 我错了";
    }

    @Override
    protected View getLoadingView() {
        View view = LayoutInflater.from(getContext()).inflate(R.layout.loadingview, null);
        Log.e("tag", "sls = "+view);
        mLVGearsTwo = view.findViewById(R.id.lv_gears_two);
        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(200,200);
        mLVGearsTwo.setLayoutParams(layoutParams);
        mLVGearsTwo.setViewColor(Color.rgb(0, 0, 0));
        return view;
    }

    @Override
    public void startLoading() {
        mLVGearsTwo.startAnim();
    }
    @Override
    public void stopLoading() {
        mLVGearsTwo.stopAnim();

    }
}
